package com.agriculture.competition.service.impl;

import com.agriculture.common.core.utils.DateUtils;
import com.agriculture.competition.domain.JaFile;
import com.agriculture.competition.mapper.JaFileMapper;
import com.agriculture.competition.service.IJaFileService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 文件上传Service业务层处理
 *
 * @author agriculture
 * @date 2024-11-14
 */
@Service
public class JaFileServiceImpl implements IJaFileService {

    @Autowired
    private JaFileMapper jaFileMapper;

    /**
     * 查询文件上传
     *
     * @param id 文件上传主键
     * @return 文件上传
     */
    @Override
    public JaFile selectJaFileById(Long id) {
        return jaFileMapper.selectJaFileById(id);
    }

    /**
     * 查询文件上传列表
     *
     * @param jaFile 文件上传
     * @return 文件上传
     */
    @Override
    public List<JaFile> selectJaFileList(JaFile jaFile) {
        return jaFileMapper.selectJaFileList(jaFile);
    }

    /**
     * 新增文件上传
     *
     * @param jaFile 文件上传
     * @return 结果
     */
    @Override
    public int insertJaFile(JaFile jaFile) {
        jaFile.setCreateTime(DateUtils.getNowDate());
        return jaFileMapper.insertJaFile(jaFile);
    }

    /**
     * 修改文件上传
     *
     * @param jaFile 文件上传
     * @return 结果
     */
    @Override
    public int updateJaFile(JaFile jaFile) {
        jaFile.setUpdateTime(DateUtils.getNowDate());
        return jaFileMapper.updateJaFile(jaFile);
    }

    /**
     * 批量删除文件上传
     *
     * @param ids 需要删除的文件上传主键
     * @return 结果
     */
    @Override
    public int deleteJaFileByIds(Long[] ids) {
        return jaFileMapper.deleteJaFileByIds(ids);
    }

    /**
     * 删除文件上传信息
     *
     * @param id 文件上传主键
     * @return 结果
     */
    @Override
    public int deleteJaFileById(Long id) {
        return jaFileMapper.deleteJaFileById(id);
    }

    @Override
    public JaFile queryByForeignKey(Long foreignKey) {
        return jaFileMapper.queryByForeignKey(foreignKey);
    }
}
